<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div class="box">
        <div class="abox">11</div>
        <div class="abox">22</div>
        <div class="abox">33</div>
        <div class="abox">44</div>
    </div>
    <script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
    <script>
        var box = document.querySelector('.box') //
        console.log($(box))//一个选元素    另外一个操作
        console.log($('.abox')) 
        $('.abox').click(function(e){
           console.log(e);
           console.log(this);
           console.log($(this));
        })
    var obj = {
        name:"1",
        children:[1,2]
    }
    var tobj = {
        age:2,
    }
    function deepClone(initalObj, finalObj) {
        var obj = finalObj || {};
        for (var i in initalObj) {
            var prop = initalObj[i];
            // 避免相互引用对象导致死循环，如initalObj.a = initalObj的情况
            if(prop === obj) {
                continue;
            }
            if (typeof prop === 'object') {
                obj[i] = (prop.constructor === Array) ? [] : {};
                console.log(arguments)
                arguments.callee(prop, obj[i]);
            } else {
                obj[i] = prop;
            }
        }
        return obj;
    }
    deepClone(obj,tobj);

    var storage = {
        add:function(key,value){
          localStorage.setItem(key,typeof value == 'object' ? JSON.stringify(value) : value);
        },
        get:function(key){
           console.log(this)
           return JSON.parse(localStorage.getItem(key));
        },
    }
    storage.add('userInfo',"age");
    storage.add('userInfo',{name:"你好"});
    console.log(storage.get('userInfo'));
    console.log(storage.get('uid'));
    function sum(){
        var storage = {
            sum:sum,
        }
        return storage;
    }
    var obj = sum();
    console.log(obj.sum())  //obj
    console.log(sum())  //window
    function barrjs(){
        this.setname = function(){
            console.log('setname')
        }
    }
    barrjs()
    console.log(window)
    setname();
    var win = window;
    console.log(win.statusbar = false)
    </script>
</body>
</html>